$(function () {
    $(".linkmmmm").click(function (e) {
        e.stopPropagation();
        e.preventDefault();

        var tdNode = $(this).parent();//得到td
        var trNode = tdNode.parent();//得到tr
        $.ajax({
            type: 'POST',
            url : 'http://localhost:8080/wenproductxiajia',
            data:  {"id":trNode.attr('id')},
            dataType:'text',
            success:(function(data){
                var judge = confirm("确认下架吗?"+data+"将会下架。")
                if(judge===true)
                {
                    $.ajax({
                        type: 'POST',
                        url : 'http://localhost:8080/productxiajia',
                        data:  {"id":trNode.attr('id')},
                        dataType:'text',
                        success:(function(data){
                            alert(data);
                            trNode.remove();
                        }),
                        error:(function (data){alert(data);})

                    });

                }
            }),
            error:(function (data){alert(data);})

        });

    });
    $(".address-item").click(function () {
        // $.ajax({
        //         type: 'POST',
        //         url : 'http://localhost:8080/productlist',
        //         data:  {"id":$(this).attr('id')},
        //         dataType:'text',
        //         success:(function(data){
        //
        //         }),
        //         error:(function (data){alert(data);})
        //
        //     });
        var url='/itemlist';
        var args= $(this).attr('id');
        var form = $("<form method='post'></form>");
        form.attr({"action":url});

        var input = $("<input type='hidden'>");
        input.attr({"name":"id"});
        input.val(args);
        console.log(args);
        form.append(input);
        $("#submitForm").append(form);
        form.submit();
        $("#submitForm").html("");
    });
    $(".link").click(function (e) {
        e.stopPropagation();
        e.preventDefault();
        var url='/productbianji';
        var zzz1= $(this).parent();
        var Node1=zzz1.parent();
        var args1=Node1.attr('id');
        var form = $("<form method='post'></form>");
        form.attr({"action":url});

        var input = $("<input type='hidden'>");
        input.attr({"name":"id"});
        input.val(args1);
        console.log(args1);
        form.append(input);
        $("#submitForm").append(form);
        form.submit();
        $("#submitForm").html("");
    });
});